package com.ht.db.router.support;

/**
 * 表名与库名环境变量holder
 */
public class DBContextHolder {

    /**
     * 数据库名key
     */
    private static final ThreadLocal<String> dbKey = new ThreadLocal<>();

    /**
     * 表名key
     */
    private static final ThreadLocal<String> tbKey = new ThreadLocal<>();

    public static void setDbKey(String dbName) {
        dbKey.set(dbName);
    }

    public static void setTbKey(String tbName) {
        tbKey.set(tbName);
    }

    public static String getDbKey() {
        return dbKey.get();
    }

    public static String getTbkey() {
        return tbKey.get();
    }

    public static void clearDbKey() {
        tbKey.remove();
    }

    public static void clearTbKey() {
        tbKey.remove();
    }

}
